/* stylelint-disable */

@ease-in-out-circ: cubic-bezier(0.78, 0.14, 0.15, 0.86);
@duration: 0.3s;
@drawer: drawer;
.@{drawer} {
  position: fixed;
  top: 0;
  z-index: 9999;
  transition:
    width 0s ease @duration,
    height 0s ease @duration,
    transform @duration @ease-in-out-circ;

  > * {
    transition:
      transform @duration @ease-in-out-circ,
      opacity @duration @ease-in-out-circ,
      box-shadow @duration @ease-in-out-circ;
  }
  &.@{drawer}-open {
    transition: transform @duration @ease-in-out-circ;
  }

  & &-mask {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0;
    background: #000;
    opacity: 0;
    transition:
      opacity @duration @ease-in-out-circ,
      height 0s ease @duration;
  }

  &-content-wrapper {
    position: absolute;
    background: #fff;
  }

  &-content {
    position: relative;
    z-index: 1;
    overflow: auto;
  }

  &-handle {
    position: absolute;
    top: 72px;
    z-index: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 41px;
    height: 40px;
    font-size: 16px;
    line-height: 40px;
    text-align: center;
    background: #fff;
    cursor: pointer;

    &-icon {
      position: relative;
      width: 14px;
      height: 2px;
      background: #333;
      transition: background @duration @ease-in-out-circ;

      &::before,
      &::after {
        position: absolute;
        display: block;
        width: 100%;
        height: 2px;
        background: #333;
        transition: transform @duration @ease-in-out-circ;
        content: '';
      }

      &::before {
        top: -5px;
      }

      &::after {
        top: 5px;
      }
    }
  }

  &-left,
  &-right {
    width: 0%;
    height: 100%;
    .@{drawer}-content-wrapper,
    .@{drawer}-content {
      height: 100%;
    }
    &.@{drawer}-open {
      width: 100%;

      &.no-mask {
        width: 0%;
      }
    }
  }

  &-left {
    left: 0;
    .@{drawer} {
      &-handle {
        right: -40px;
        border-radius: 0 4px 4px 0;
        box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
      }
    }
    &.@{drawer}-open {
      .@{drawer} {
        &-content-wrapper {
          box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15);
        }
      }
    }
  }

  &-right {
    right: 0;
    .@{drawer} {
      &-content-wrapper {
        right: 0;
      }

      &-handle {
        left: -40px;
        border-radius: 4px 0 0 4px;
        box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
      }
    }
    &.@{drawer}-open {
      & .@{drawer} {
        &-content-wrapper {
          box-shadow: -2px 0 8px rgba(0, 0, 0, 0.15);
        }
      }

      &.no-mask {
        // https://github.com/ant-design/ant-design/issues/18607
        right: 1px;
        transform: translateX(1px);
      }
    }
  }

  &-top,
  &-bottom {
    width: 100%;
    height: 0%;
    .@{drawer}-content-wrapper,
    .@{drawer}-content {
      width: 100%;
    }
    .@{drawer}-content {
      height: 100%;
    }
    &.@{drawer}-open {
      height: 100%;

      &.no-mask {
        height: 0%;
      }
    }

    .@{drawer} {
      &-handle {
        left: 50%;
        margin-left: -20px;
      }
    }
  }

  &-top {
    top: 0;
    .@{drawer} {
      &-handle {
        top: auto;
        bottom: -40px;
        border-radius: 0 0 4px 4px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
      }
    }
    &.@{drawer}-open {
      .@{drawer} {
        &-content-wrapper {
          box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
        }
      }
    }
  }

  &-bottom {
    bottom: 0;
    .@{drawer} {
      &-content-wrapper {
        bottom: 0;
      }

      &-handle {
        top: -40px;
        border-radius: 4px 4px 0 0;
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
      }
    }
    &.@{drawer}-open {
      .@{drawer} {
        &-content-wrapper {
          box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
        }
      }

      &.no-mask {
        // https://github.com/ant-design/ant-design/issues/18607
        bottom: 1px;
        transform: translateY(1px);
      }
    }
  }
  &.@{drawer}-open {
    .@{drawer} {
      &-mask {
        height: 100%;
        opacity: 0.3;
        transition: opacity 0.3s @ease-in-out-circ;
      }

      &-handle {
        &-icon {
          background: transparent;

          &::before {
            transform: translateY(5px) rotate(45deg);
          }

          &::after {
            transform: translateY(-5px) rotate(-45deg);
          }
        }
      }
    }
  }
}
